﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace PictureInterference.Helper.CreateText
{
    class InterferenceHelper
    {/// <summary>
    /// 获取任意一个干扰字符
    /// </summary>
    /// <returns></returns>
        private static string GetString() {
            return TextStaticValue.SpecialSymbol1[new Random().Next(TextStaticValue.SpecialSymbol1.Count)];
        }
        private  static string Temp = "";
        public static string CreateInterfere(int Count) {
            string Temptext = "";
            for (int i = 0; i < Count; i++) {
                while (true) {

                    string GetText = GetString();
                    if (GetText != Temp)
                    {
                        Temp = GetText;
                        Temptext += GetString();
                        break;
                    }
                }

            }

            return Temptext;
        }
        public static string CreateText(int Count, string Content) {

            var s = string.Join(CreateInterfere(Count), Regex.Matches(Content, @"..").Cast<Match>().ToList());

            return s;


        }
    }
}
